home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / dlbox_2 / pics.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-27  |  1.7 KB  |  81 lines

  1. #include "inter.h"
  2. #include<alloc.h>
  3. #include<stdio.h>
  4. #include<process.h>
  5. interface_class iface;
  6. void initg()
  7. {
  8.   int gdriver = DETECT, gmode, errorcode;
  9.   initgraph(&gdriver, &gmode, "");
  10. //  errorcode = graphresult();
  11.   settextstyle(DEFAULT_FONT,HORIZ_DIR,1);
  12. }
  13. char deet[127];
  14.  
  15. void far *p1,*p2,*p3,*p4;
  16.  
  17. do_sample_pics()
  18. {
  19.   unsigned size;
  20.  
  21.   size=imagesize(0,0,109,69);
  22.  
  23.   settextstyle(GOTHIC_FONT,HORIZ_DIR,4);
  24.   settextjustify(CENTER_TEXT,CENTER_TEXT);
  25.   setfillstyle(SOLID_FILL,LIGHTGRAY);
  26.   bar(0,0,109,69);
  27.   setcolor(BLUE);
  28.   rectangle(0,0,109,69);
  29.   outtextxy(55,35,"P1");
  30.   p1=farmalloc(size);
  31.   getimage(0,0,109,69,p1);
  32.  
  33.   bar(0,0,109,69);
  34.   setcolor(GREEN);
  35.   rectangle(0,0,109,69);
  36.   outtextxy(55,35,"P2");
  37.   p2=farmalloc(size);
  38.   getimage(0,0,109,69,p2);
  39.  
  40.   bar(0,0,109,69);
  41.   setcolor(RED);
  42.   rectangle(0,0,109,69);
  43.   outtextxy(55,35,"P3");
  44.   p3=farmalloc(size);
  45.   getimage(0,0,109,69,p3);
  46.  
  47.   bar(0,0,109,69);
  48.   setcolor(YELLOW);
  49.   rectangle(0,0,109,69);
  50.   outtextxy(55,35,"P4");
  51.   p4=farmalloc(size);
  52.   getimage(0,0,109,69,p4);
  53. }
  54.  
  55. test_box()
  56. {
  57.   iface.clear();
  58.   iface.addbox(185,51,271,218);
  59.   iface.addbar("Picture Buttons",1);
  60.   iface.addpic_b(20,40,110,70,1,p1);
  61.   iface.addpic_b(140,41,110,70,2,p2);
  62.   iface.addpic_b(20,120,110,70,3,p3);
  63.   iface.addpic_b(140,120,110,70,4,p4);
  64.   iface.dodialog();
  65.  
  66.   closegraph();
  67.  
  68.   printf("Button 1: %d\n",iface.get_button_info(1));
  69.   printf("Button 2: %d\n",iface.get_button_info(2));
  70.   printf("Button 3: %d\n",iface.get_button_info(3));
  71.   printf("Button 4: %d\n",iface.get_button_info(4));
  72. }
  73.  
  74. main()
  75. {
  76.   initg();
  77.   do_sample_pics();
  78.   cleardevice();
  79.   test_box();
  80.   exit(0);
  81. }